class SlideTrack():
    """
    滑动轨迹的生成
    以p轨迹数组为模版，按比例替换p中的X，其他的y和time都保持不变
    """

    p = [[4, 1, 109], [7, 1, 122], [10, 1, 132], [12, 1, 142], [15, 1, 151], [17, 1, 159], [20, 1, 167], [22, 1, 174],
         [24, 1, 182], [25, 1, 190], [27, 1, 197], [29, 1, 205], [30, 1, 212], [31, 1, 220], [34, 1, 227], [37, 1, 234],
         [40, 1, 242], [43, 0, 250], [46, 0, 259], [48, 0, 266], [50, 0, 274], [53, 0, 282], [54, -1, 290],
         [56, -1, 298], [57, -1, 307], [59, -1, 314], [60, -1, 322], [61, -1, 330], [63, -2, 338], [64, -2, 346],
         [66, -2, 354], [68, -2, 362], [69, -2, 369], [72, -2, 377], [75, -2, 384], [77, -3, 392], [81, -3, 402],
         [83, -3, 410], [85, -4, 420], [89, -4, 427], [92, -5, 435], [95, -5, 442], [98, -5, 450], [101, -5, 457],
         [105, -5, 464], [108, -5, 472], [109, -5, 480], [111, -6, 487], [112, -6, 495], [113, -6, 503], [113, -6, 511],
         [114, -6, 618], [114, -6, 628], [115, -6, 638], [116, -6, 647], [117, -6, 655], [118, -6, 663], [120, -6, 671],
         [122, -6, 678], [123, -6, 686], [125, -6, 694], [128, -6, 701], [130, -6, 709], [131, -6, 717], [132, -6, 724],
         [133, -7, 732], [133, -7, 739], [133, -7, 747], [134, -7, 758], [134, -7, 880], [134, -7, 889], [134, -7, 898],
         [135, -7, 906], [135, -7, 914], [135, -7, 922], [135, -7, 929], [136, -7, 936], [136, -7, 943], [136, -7, 951],
         [137, -7, 958], [137, -7, 1045], [137, -7, 1054], [137, -7, 1061], [137, -6, 1069], [137, -6, 1076],
         [138, -6, 1083], [138, -6, 1090], [138, -6, 1100], [138, -6, 1110]]

    @classmethod
    def get_slice_track(cls, left_x):
        # 根据传入的偏移值，计算比例。
        left_scale = left_x / len(cls.p)
        # for i in cls.p:
        #     new_path = cls.get_new_ary(i, left_scale)
        #     new_ary.append(new_path)
        new_ary = [cls.get_new_ary(i, left_scale) for i in cls.p]
        return new_ary

    @staticmethod
    def get_new_ary(ary, scale):
        x = ary[0]
        y = ary[1]
        t = ary[2]
        return [int(scale * x), y, t]

